{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "12746e6e",
   "metadata": {},
   "source": [
    "# TVM ARM 目标平台测试文档"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "5bd5f282",
   "metadata": {},
   "outputs": [],
   "source": [
    "import tvm\n",
    "from tvm.script import ir_module, relax as R\n",
    "\n",
    "@ir_module\n",
    "class ReshapeModule:\n",
    "    @R.function\n",
    "    def main(x: R.Tensor((1, 80, 800), \"float32\")) -> R.Tensor((1, 5, 800, 1, 16), \"float32\"):\n",
    "        gv0 = R.reshape(x, (1, 5, 16, 800))\n",
    "        gv1 = R.permute_dims(gv0, axes=(0, 1, 3, 2))\n",
    "        gv2 = R.expand_dims(gv1, axis=3)\n",
    "        return gv2\n",
    "\n",
    "# 编译 Relax 模块\n",
    "target = tvm.target.Target(\"llvm\")\n",
    "ex = tvm.compile(ReshapeModule, target=target)\n",
    "\n",
    "# 导出为共享库\n",
    "ex.export_library(\"reshape_scenario_a.so\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "cd2e8b7a",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "aix",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
